import request from "@/utils/request.js";

/**
 * 新增胎位分配信息
 * @param data 表单数据
 */
export const addBayAssignedSegmentService = (data) => {
  return request.post("bay_assignment/addBayAssignedSegment", data);
};

/**
 * 获取胎位分配信息分页列表
 * @param params 查询参数 { current, pageSize, ship_number, segment_number }
 */
export const getBayAssignedSegmentsService = (params) => {
  return request.get("bay_assignment/getBayAssignedSegments", {
    params,
  });
};

/**
 * 获取单个胎位分配详情（用于编辑）
 * @param id assignment_id
 */
export const getBayAssignedSegmentDetailService = (id) => {
  return request.get(`bay_assignment/bayAssignedSegmentDetail/${id}`);
};

/**
 * 修改胎位分配信息
 * @param id assignment_id
 * @param data 表单数据
 */
export const updateBayAssignedSegmentService = (id, data) => {
  return request.put(`bay_assignment/bayAssignedSegmentDetail/${id}`, data);
};

/**
 * 删除单个胎位分配信息
 * @param id assignment_id
 */
export const deleteBayAssignedSegmentService = (id) => {
  return request.delete(`bay_assignment/bayAssignedSegmentDetail/${id}`);
};

/**
 * 批量删除胎位分配信息
 * @param entities 要删除的对象数组，格式：[{ assignment_id }, ...]
 */
export const batchDeleteBayAssignedSegmentsService = (entities) => {
  return request.post("bay_assignment/deleteBayAssignedSegments", { entities });
};


/**
 * 批量新增胎位分配信息
 * @param list 要新增的对象数组，格式：[{ ... }, { ... }]
 */
export const batchAddBayAssignedSegmentsService = (list) => {
  return request.post("bay_assignment/batchAddBayAssignedSegments", {
    list,
  });
};
